#include <iostream>
using namespace std;
#include "stdlib.h"
#include "time.h"
int main()
{
	int a, b, numofques=0, numofright=0;
	char inquiry;
	float lv;
	srand(time(NULL));//yongyu chansheng suiji shu.
	cout << "  huanying lai zuo yiwei shu de jiajian chengchu.  " << endl;
	do
	{
		int temp = rand()%4;//suiji chansheng +,- * /.
		a = rand()%10;//chansheng 1weishu de suiji shu.
		b = rand()%10;//chansheng 1weishu de suiji shu.
		b != 0;
		switch(temp)
		{
			case 0:
			{
				int ans;//yongyu cunchu da'an.
				cout << a << '+' << b << endl;
				cin >> ans;
				
				if (ans == a + b)
				{
					numofright++;
					cout << "you are right!" << endl;
				}
				else 
				{
					numofques++;
					cout << "you are ont right,come on!" << endl;
				}
				break;
			}
			case 1:
			{
				int ans;
				cout << a << '-' << b << endl;
				cin >> ans;
				
				if (ans == a - b)
				{
				    numofright++;
					cout << "you are right!" << endl;
				}
				else 
				{
					numofques++;
					cout << "you are ont right,come on!" << endl;
				}
				break;
			}
			case 2:
			{
				int ans;
				cout << a << '*' << b << endl;
				cin >> ans;
				
				if (ans == a * b)
				{
				    numofright++;
					cout << "you are right!" << endl;
				}
				else 
				{
					numofques++;
					cout << "you are ont right,come on!" << endl;
				}
				break;
			}
			case 3:
			{
				int ans;
				cout << a << '/' << b << endl;
				cin >> ans;
				
				if (ans == a / b)
				{
				    numofright++;
					cout << "you are right!" << endl;
				}
				else 
				{
					numofques++;
					cout << "you are ont right,come on!" << endl;
				}
				break;
			}
		}
		cout << "ni hai yao zai zuo yi ci ma ?(n is stop!)"	<< endl;//xunwen yonghu zaici shifu shuru y,m,d.
		cin >> inquiry;
	}while ( inquiry != 'n' && inquiry != 'N');
	
	lv=((float)numofright/(numofright+numofques))*100;
	//genju panduan zhengque lv shuchu butong de nengrong.
	if (lv > 0 && lv < 60){
		cout << " xutao nvli ,come on!" << endl;
	}
	else if (lv >= 60 && lv < 80){
		cout << "jige haixu nvli!" << endl;
	}
	else if (lv >=80 && lv < 100){
		cout << "you are good!" <<endl;
	}
	else if (lv = 100 ){
		cout << "you are very good!" << endl;
	}
	cout << "ni de zhengque lv shi : " << lv << '%' <<endl;
	return 0;
}
